package com.zhgxi.zf.util;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.*;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class AMFSessionFilter implements Filter {
	private static Log log = LogFactory.getLog(AMFSessionFilter.class);

	public void init(FilterConfig config) {
		log.info("Init AMFSessionFilter filter");
	}

	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws ServletException, IOException {
		AMFContext.setCurrentContext((HttpServletRequest) request,
				(HttpServletResponse) response);
		chain.doFilter(request, response);
	}

	public void destroy() {
		log.info("Destory AMFSessionFilter filter");
	}
}
